<?php

class Silk_View_Helper_ObjectRender {

    public function objectRender($pObject, $pAction='view'){
	if ($pObject instanceof Silk_Object)
	    $object = $pObject;
	else {
	    $Objects = new Silk_Objects();

	    if (is_array($pObject)){
		$results = $Objects->fetch($pObject);
		if (count($results) > 0)
		    $object = $results->current();
		else
		    return null;
	    } else if (is_numeric($pObject)){
		$object = $Objects->fetch($pObject);
	    } else {
		$object = $Objects->fetchBySlug($pObject, true);
	    }
	}
	return $object->render($pAction);
    }
}

?>